/*
 *   AS IS License 
 *  ==Naive Coders==
 */
package com.naivecoders.refex.functions;

import com.naivecoders.refex.FunctionFactory;

/**
 *
 * @author andrew
 */
public class EqualsFunction extends AbstractFunction {

    public EqualsFunction(FunctionFactory origin) {
        super(origin);
    }
      
    @Override
    public AbstractFunction evaluate(ListFunction x) throws InvocationException {
        final AbstractFunction first = arg(x, 0);
        final AbstractFunction second = arg(x, 1);
        return first.equals(second) ? getOrigin().trueFunction() : this;
    }
    
}
